package com.yanqu.road.server.cmd.player;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.player.PlayerProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_FORBID_ONLINE_PLAYER, desc = "封号")
public class ForbidPlayerCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        PlayerProto.ForbidOnLinePlayerReqMsg reqMsg = PlayerProto.ForbidOnLinePlayerReqMsg.parseFrom(packet.getBytes());
        player.getUserInfo().setBlackListEndTime(System.currentTimeMillis() + reqMsg.getTime());
        GamePlayerMgr.onLogout(player, true);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
